﻿using ASmile.CodeFactory.DBModel;
using ASmile.Extend;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;

namespace ASmile.CodeFactory.DaBLL.Builder
{
    class BuilderMySql : IBuilder
    {
        public BuilderMySql(TConfig config)
            : base(config)
        { }

        public override DataTable GetProcParamSchema(string procName)
        {
            return GetSchema("ORDINAL_POSITION", "Procedure Parameters", null, null, procName);
        }

        protected override DataTable GetProcSchema()
        {
            //TODO: MySQL未测试，可以根据参数过滤 Routine_Schema <> 'sys' 而不用以下实现
            //var dt = GetSchema("Specific_Name", "Procedures", null, null, null, "Procedure");
            //dt.DefaultView.Sort = "Specific_Name";

            var dt = base.GetProcSchema();
            dt.DefaultView.RowFilter = "Routine_Schema <> 'sys'";
            return dt.DefaultView.ToTable();
        }
    }
}
